home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlx_sq15.zip / RBBSREG.SLT < prev    next >
Text File  |  1990-11-02  |  6KB  |  206 lines

  1. //-----------------------------------------------------------
  2. // RBBSREG.SL? Automatic registration to a new RBBS.
  3.  
  4. // Telix script for first logon to an RBBS system.
  5. // This script is normally called from the script RBBS.SLC.
  6. //
  7. // Please look at the comments through the whole file, and modify to
  8. // suit your needs, BEFORE you use it. Then recompile with CS RBBSREG. 
  9. //-----------------------------------------------------------
  10.  
  11. str thisBBStype[]="RBBS"     // Works only for RBBS.
  12.    ,line       [80]          // Line for string storage.
  13.    ,temp        [4]          // Temporary for short strings.
  14.                              // For the Global storage:
  15.    ,global   []="GLOBAL"     // Global script.
  16.    ,bbstype  []="BTYPE"      // BBS type.
  17.    ,cprot    []="CPROT"      // Current protocol.
  18.    ,name     []="NAME"       // User name
  19.    ,addr     []="ADDR"       // Address
  20.    ,country  []="STATE"      // Country
  21.    ,mail     []="MAIL"       // Mail address
  22.    ,hfone    []="HTEL"       // Home phone
  23.    ,wfone    []="WTEL"       // Work phone
  24.    ,work     []="WORK"       // Profession
  25.    ,telver   []="TELVER"     // Telix version number
  26.    ,modem    []="MODEM"      // Type of modem
  27.    ,cpu      []="CPU"        // Type of CPU
  28.    ,passw    []="PASSW"      // Actual password
  29.    ;     
  30.  
  31. int tol = 300                // No activity for ½ minute
  32.    ,i, x                     // makes script time out.
  33.    ,stat, tmark
  34.    ;
  35.  
  36. //-----------------------------------------------------------
  37. // Script starts here.
  38. //-----------------------------------------------------------
  39.  
  40. main()
  41. {
  42. int l;
  43.  
  44.   entry();                               // Updates colors & status bar. 
  45.  
  46. // Only if online.
  47.  
  48.   if (!carrier())  
  49.   { failtone();
  50.     status_wind ("THIS SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
  51.     return (-1);
  52.   }
  53.  
  54.   read (bbstype,line);                   // Get current BBS type.
  55.   if (line != thisBBStype)  
  56.   { wrongBBS();                          // Doesn't match script!
  57.     return (-1);
  58.   }
  59.  
  60. // Wait for your own name.
  61.  
  62.   read (name,line);                      // Get user name.
  63.   if (!waitfor (line,3))                 // Wait 3 sec. for echo.
  64.     return (-1);                         // Incorrect.
  65.  
  66.   flush();
  67.   cputs ("Y^M");                         // Correct; answer Yes.
  68.  
  69.   if (!waitfor("CITY and COUNTRY?",3))   // Wait again.
  70.     return (-2);                         // Not received.
  71.  
  72. // Construct city and country, fx "SANDVIKA NORWAY".
  73.  
  74.   read (addr,line);                      // Get address.
  75.   l = strlen(line);
  76.   for (i=0; i<l; ++i)  
  77.   { if (subchr(line,l) > '9')            // Skip postal code
  78.       break;
  79.   }
  80.   for ( ; i<l; ++i)                      // Copy post-office name.
  81.     cputc (subchr (line,l));             // Send the rest.
  82.  
  83.   cputs (" ");
  84.   read (country,line);
  85.   cputs (line);                          // Echo city and country.
  86.   cputs ("^M");
  87.  
  88.   waitfor ("Key to continue",3);         // Wait again.
  89.   cputs ("^M");                         
  90.  
  91.   waitfor ("[R]egister?",3);             // Want to register?
  92.   cputs ("R^M");                         // Of course!
  93.  
  94.   waitfor ("use to logon again?",3);     // Wait for password request.
  95.  
  96.   read (passw,line);
  97.   for (i=0;i<2; ++i)                     // Password must be sent twice.
  98.   { cputs(line);             
  99.     cputs("^M");
  100.     if (i==0)
  101.     waitfor ("Verification (Dots Echo)?",3); // Verify password.
  102.   }
  103.  
  104.   waitfor ("present yourself now? (Y/N)?",3); // Present yourself.
  105.   cputs ("Y^M");
  106.  
  107.   waitfor ("voice phone number?",3);     // Voice phone
  108.   read (hfone,line);
  109.   cputs (line);
  110.   cputs ("^M");
  111.  
  112.   waitfor ("address (on one line please)",3); // Street address
  113.   read (addr,line);
  114.   cputs (line);
  115.   cputs ("^M");
  116.  
  117.   waitfor ("School do you go to?",3);    // School or work
  118.   read (work,line);
  119.   cputs (line);
  120.   cputs ("^M");
  121.  
  122.   waitfor ("(Type ^"N^" if nothing)",3);
  123.   cputs ("N^M");
  124.  
  125.   waitfor ("ll on one line, please)",3); // Modem and program
  126.   read (modem,line);
  127.   cputs (line);
  128.   cputs (", TELIX ver. ");
  129.   read (telver,line);
  130.   cputs (line);
  131.   cputs ("^M");
  132.  
  133.   waitfor ("system(s) do you use?",3);   // Computer system(s)
  134.   read (cpu,line);
  135.   cputs (line);
  136.   cputs ("^M");
  137.  
  138.   waitfor ("with your answers (Y/N)?",3);// Satisfied?
  139.   cputs ("Y^M");
  140.  
  141.   waitfor ("C)ontinuous,A)bort?",5);     // More?
  142.   cputs ("N^M");                         // No thanks.
  143.  
  144.   return(0);                             // Registration OK.         
  145. }
  146.                                          
  147. //-----------------------------------------------------------
  148. // Wrong BBS type.
  149. //-----------------------------------------------------------
  150.  
  151. wrongBBS()
  152. {
  153. str help[48];
  154.  
  155.     failtone();                          // Alarm.    
  156.     help = "This script is for ";        // Catenate strings.
  157.     strcat (help,thisBBStype);
  158.     strcat (help," only!");
  159.     status_wind (help,20);               // Display message for 2 sec.
  160. }
  161.  
  162. //-----------------------------------------------------------
  163. // Play fail tone.
  164. //-----------------------------------------------------------
  165.  
  166.  failtone()
  167. {
  168.   int n;
  169.   for (n=140; n > 10; n = 100*n/120) 
  170.   { tone(n*10,12);                       // Fail tone!!
  171.     terminal();                          // Process text.
  172.   }
  173. }
  174.                                         
  175. //-----------------------------------------------------------
  176. // Routine to update colors and status bar.
  177. //-----------------------------------------------------------
  178.  
  179. entry ()
  180. {
  181.   _back_color = 1;
  182.   _fore_color = 14;
  183.   update_term();
  184. }
  185.  
  186. //-----------------------------------------------------------
  187. // Read a global variable.
  188. //-----------------------------------------------------------
  189.  
  190. read (str name, str varname)
  191. {
  192.   return (call (global,"R",name,varname));
  193. }
  194.  
  195. //-----------------------------------------------------------
  196. // Flush incoming text from BBS.
  197. //-----------------------------------------------------------
  198.  
  199. flush()
  200. {
  201.   do
  202.   { terminal();                          // Process all echo
  203.     delay(1);                            // from the BBS.
  204.   } while (cinp_cnt() > 0);
  205. }
  206.